/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package practice;
import java.math.BigInteger;
import java.io.IOException;
import static chanlib.Chan_Math.*;
import static chanlib.Chan_IO.*;
import static java.lang.Math.min;
import static java.lang.Math.max;
/**
*
* @author Chan
*/
public class FairWarning {
/*
All neccesary to be defined
including:
variable, inner class
*/
// static int A;
// static void B();
// static class C
/*
One calculation fits all of the cases.
*/
static void preReckon(){
}
/*
calculate the answer
*/
private static void reckon(int line) {
int N=Int();
BigInteger[] t=new BigInteger[N];
for(int i=0;i<N;i++)
t[i]=new BigInteger(String());
int minI=N-1;
BigInteger minT=t[N-1];
for(int i=N-2;i>=0;i--){
if(t[i].compareTo(minT)<0){
minT=t[i];
minI=i;
}
}
BigInteger ZERO=BigInteger.ZERO;
BigInteger GCD=ZERO;
for(int i=0;i<N;i++){
GCD=GCD.gcd(t[i].subtract(t[minI]));
}
BigInteger rem=t[minI].mod(GCD);
BigInteger ans = rem.equals(ZERO)?ZERO:GCD.subtract(rem);
String output=String.format("Case #%d: %s",line,ans.toString());
writeln(output, OUTFILE);
//writeln(String.format("N=%d K=%d\n%s", N, K, ans),ANALFILE);
println(output);
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws IOException {
/*
Pre-computing for all cases
*/
// Just in case!
preReckon();
//while((char)read()!='P');
/*
Input-output
*/
boolean test=false;
boolean small=false;
String prob="B";
String filename;
if(test) filename="test";
else{
if(small) filename=prob+"-small-practice";
else filename=prob+"-large-practice";
}
try {
/*
Init IO,plus determination of input line number
*/
int lineNums = initFileIO(filename);
for (int i = 1; i <= lineNums; i++) {
reckon(i);
}
} finally {
endIO();
}
}
}